package com.xbx.vod.controller;

import com.xbx.commonutils.R;
import com.xbx.vod.service.VodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@CrossOrigin
@RestController
@RequestMapping("eduvod/video")
public class VodController {
    @Autowired
    private VodService vodService;
    //上传视频到阿里云
    @PostMapping("uploadVideo")
    public R uploadVideo(MultipartFile file){
        String videoId=vodService.upload(file);
        return R.ok().data("videoId",videoId);
    }
    @DeleteMapping("deleteVideo/{id}")
    public R deleteVideo(@PathVariable String id){
        vodService.deleteVideo(id);
        return R.ok();
    }
}
